package org.zfes.snowier.zbss.xzy.router.zmd;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.zmd.model.ModataCpu;
import org.zfes.snowier.zbss.xzy.biz.zmd.service.IModataCpuService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/xzy")
public class ModataCpuController implements BaseController {

	
	@Autowired
	private IModataCpuService modataCpuService;
	
	//@RequiresPermissions(value="modataCpu:loadModataCpuDataSet",desc="监控CPU列表")
    @RequestMapping(value="/loadModataCpuDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataCpuDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  modataCpuService.loadModataCpuDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="modataCpu:createModataCpu",desc="监控CPU添加")
    @RequestMapping(value="/createModataCpu", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createModataCpu(@RequestBody ModataCpu modataCpu){
		modataCpuService.createModataCpu(modataCpu);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataCpu:loadModataCpu",desc="监控CPU加载")
    @RequestMapping(value="/loadModataCpu/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataCpu(@PathVariable("id")Long id){
		Optional<ModataCpu> ops = modataCpuService.loadModataCpuById(id);
		return ajaxQuery("modataCpu",ops);
    }
	
	//@RequiresPermissions(value="modataCpu:updateModataCpu",desc="监控CPU更新")
    @RequestMapping(value="/updateModataCpu", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateModataCpu(@RequestBody  ModataCpu modataCpu){
		modataCpuService.updateModataCpu(modataCpu);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataCpu:deletModataCpu",desc="监控CPU删除")
    @RequestMapping(value="/deleteModataCpu/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteModataCpu(@PathVariable("id")Long id){
		modataCpuService.deleteModataCpu(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadModataCpuSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataCpuSelectVo(){
		 List<SelectVo>  ops = modataCpuService.loadModataCpuSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}